package cn.ustb.serviceImpl;

import cn.ustb.dao.TeacherDao;
import cn.ustb.entity.TeacherInformation;
import cn.ustb.entity.User;
import cn.ustb.service.TeacherInformationService;
import cn.ustb.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author yuyan
 */
public class TeacherInformationServiceImpl implements TeacherInformationService {

    @Override
    public TeacherInformation get(User user) {
        SqlSession sqlSession=null;
        try{
            sqlSession= MyBatisUtil.getInstance();
            TeacherDao teacherDao=sqlSession.getMapper(TeacherDao.class);
            return teacherDao.get(user.getUsername());
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if (sqlSession!=null){
                sqlSession.close();
            }
        }
        return null;
    }
}
